//
//  TWVideoCollectionWithBrief.swift
//  EyepetizerImitative
//
//  Created by 田伟 on 2017/4/11.
//  Copyright © 2017年 个人. All rights reserved.
//

import UIKit

protocol VideoCollectionWithBriefDelegate : NSObjectProtocol {
    func pushViewControllerWith(model : TWVideoCollectionOfAuthorWithCoverModel)
}

class TWVideoCollectionWithBrief: UITableViewCell {

    @IBOutlet weak var topView: UIView!
    @IBOutlet weak var iconImageView: UIImageView!
    @IBOutlet weak var nameLabel: UILabel!
    @IBOutlet weak var introductionLabel: UILabel!
    @IBOutlet weak var attentionButton: UIButton!
    @IBOutlet weak var lineLabel: UILabel!
    
    @IBAction func tapBrief(_ sender: Any) {
        videoCollectionWithBriefDelegate?.pushViewControllerWith(model: model!)
    }
    @IBOutlet weak var bottomCollectionView: TWDetailCollectionView!
    
    var videoCollectionWithBriefDelegate : VideoCollectionWithBriefDelegate?
    
    var model : TWVideoCollectionOfAuthorWithCoverModel?{
        didSet {
            guard let model = model else {
                return
            }
            iconImageView.sd_setImage(with: URL(string: (model.header?.icon)!))
            nameLabel.text = model.header?.title
            introductionLabel.text = model.header?.tw_description
            // 设置detailCollectionView的内容
            bottomCollectionView.videosArray = model.itemList_tw
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        attentionButton.layer.masksToBounds = true
        attentionButton.layer.cornerRadius = 4
        attentionButton.layer.borderWidth = 1
        attentionButton.layer.borderColor = UIColor.black.cgColor
    
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
